package com.eblacorp.archive.util.ce;

import java.beans.IntrospectionException;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.List;

import com.eblacorp.archive.domain.fn.Archivable;
import com.eblacorp.archive.exceptions.NotFnDocumentException;
import com.eblacorp.archive.exceptions.NullValueException;
import com.filenet.api.collection.IndependentObjectSet;
import com.filenet.api.collection.RepositoryRowSet;
import com.filenet.api.constants.CheckinType;
import com.filenet.api.constants.RefreshMode;
import com.filenet.api.core.Document;
import com.filenet.api.core.ObjectStore;
import com.filenet.api.query.SearchSQL;
import com.filenet.api.util.Id;

public interface ContentEngineUtil <T extends Archivable> extends Serializable{
	public SearchSQL getSeatchSQL(T t, Integer maxRecords, String[] dateProperties, Date[] dateFrom, Date[] dateTo) throws NotFnDocumentException, IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException;
	public List<T> getObjects(RepositoryRowSet repositoryRowSet)throws NotFnDocumentException, IllegalAccessException, InstantiationException, IntrospectionException, IllegalArgumentException, InvocationTargetException;
	public List<T> getObjects(IndependentObjectSet independentObjectSet) throws InstantiationException, IllegalAccessException, IntrospectionException, IllegalArgumentException, InvocationTargetException;
	public void setPersistentClass(Class<T> persistentClass) throws NotFnDocumentException;
	public Document fetchDocumentById(ObjectStore objectStore, Id id, boolean withContent);
	public T getObject(Document document) throws InstantiationException, IllegalAccessException, IntrospectionException, IllegalArgumentException, InvocationTargetException;
	public Document addContent(Document document, File file) throws IOException;
	public Document createDocument(ObjectStore objectStore, T t) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, NullValueException;
	public Document updateDocument(ObjectStore objectStore, T t) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, NullValueException ;
	public Document checkinDocument(Document document, CheckinType checkinType, RefreshMode refreshMode);
	public Document checkoutDocument(Document document);
	public void saveDocument(Document document, RefreshMode refreshMode);
	public void delete(Document document , boolean allVersion);
	public Document fillFnDocument(T t, ObjectStore objectStore) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, NullValueException;
	public byte[] download(Document document, ObjectStore objectStore) throws IOException;
}
